package cn.usersearch.service;

import java.util.List;

import jp.terasoluna.fw.dao.QueryDAO;
import jp.terasoluna.fw.dao.UpdateDAO;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import cn.usersearch.bean.UserBean;

@Service
public class LoginService {

	@Autowired
	QueryDAO queryDao;

	@Autowired
	UpdateDAO updateDao;

	
	public List<UserBean> searchUser(UserBean frm) {
		List<UserBean> result;
		if(frm==null)
		{result= queryDao.executeForObjectList("User.selectUser1", null);
		//frm.setUserId("test");
		}
		else 
			result= queryDao.executeForObjectList("User.selectUser", frm);
		return result;
	}
	public int searchinsert(UserBean frm) {
		return updateDao.execute("User.insertUser", frm);
	}
	public int searchupdate(UserBean frm){
		return updateDao.execute("User.updateUser", frm);
	}
	public int searchdelete(UserBean frm){
		return updateDao.execute("User.deleteUser", frm);
	}
	
}
